# -*- coding: utf-8 -*-
"""
Created on Mon Oct 08 19:25:06 2012

@author: Tomek
"""

import namespace
import sys

#sys.argv[1]==file to save compiled global namespace

if namespace._DEBUG_:
    namespace.saveNamespace("_ns_",namespace.getGlobalNamespace())
if len(sys.argv)==2:
    ns=[]
    f=open("config.txt","r")
    for x in f.readlines():
        n=namespace.loadNamespace(x)
        ns.append(n)
    f.close()
    if len(ns)!=0:
        final_ns=ns[0]
        for x in ns:
            final_ns.merge(x,True)
        fullpath=""
        for p in range(1,len(sys.argv)):
            fullpath=fullpath+" "+sys.argv[p]
        namespace.saveNamespace(fullpath,final_ns)